package com.xiaoshuidi.cloud.module.system.dal.mysql.user;

import com.xiaoshuidi.cloud.framework.mybatis.core.mapper.BaseMapperX;
import com.xiaoshuidi.cloud.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xiaoshuidi.cloud.module.system.api.user.dto.CustomerUserRespDTO;
import com.xiaoshuidi.cloud.module.system.dal.dataobject.user.CustomerUserDO;
import org.apache.ibatis.annotations.Mapper;


@Mapper
public interface CustomerUserMapper extends BaseMapperX<CustomerUserDO> {
    default CustomerUserDO selectByMobileAndOther(CustomerUserRespDTO dto){
        return selectOne(new LambdaQueryWrapperX<CustomerUserDO>()
                .eq(CustomerUserDO::getMobile,dto.getMobile())
                .eqIfPresent(CustomerUserDO::getUsername,dto.getUsername())
                .eqIfPresent(CustomerUserDO::getIdNumber,dto.getIdNumber()));
    }
}
